package users

import (
	"api/internal/respons"
	"api/internal/svc"
	"api/internal/types"
	"context"
	"go.uber.org/zap"
	"smart-health-platforms/pkg"
	"user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type DeletedFaseLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewDeletedFaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeletedFaseLogic {
	return &DeletedFaseLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

// 删除人脸
func (l *DeletedFaseLogic) DeletedFase(req *types.DeletedFaseRequest) (resp *types.Response, err error) {
	fase, err := l.svcCtx.UserRpc.DeletedFase(l.ctx, &user.DeletedFaseRequest{
		UserId: req.UserId,
		FaceId: int32(req.FaceId),
	})
	if err != nil {
		pkg.Error("修改失败", zap.Error(err))
		return nil, err
	}

	return respons.Success(fase), nil
}
